<## hts-v2.97 analyzelinks.hts - build a report of links on a web page PROCEDURE FOR INSTALLING THIS ACTIVE DOCUMENT: 1. Copy the sample active document "analyzelinks.hts" to the directory where htmlscript active documents are stored. 2. The active document should run!! WHERE TO GET HELP: htmlscript maintains an open list server for the htmlscript users group. You can post messages to this list with questions and items of interest for other htmlscript users. To subscribe to this list send email to majordomo@htmlscript.com with the following on the *first line* of the message body (not the subject): subscribe hts-users youremail@domain.com To post messages to the list send email to hts-users@htmlscript.com ##> <## This line builds the URL for this active document, it should not need to be changed. The server_name variable contains the domain name of the server. The script_name variable contains the path to the htmlscript executable. The arg1 variable contains the name of the active document. ##> <## this is the start of the active document ##>
Analyze Links On A Web Site

<## at this point in the active document, the base url is derived for anchor reconstruction ##> <## make the callurl the default baseurl until we find out otherwise ##> <## get ending position in string ##> <## now step thru string, from end to beginning looking for a slash ##> <## if the char at postion is not a slash, then we know that we do not have double slashes (if we had double slashs then we know that we moved *back* too far in the URL and there is no /filename found) ##> <## this is where the active document starts getting the links ##> <## flag to signal that we are inside an tag ##> Analysis Of Links On: &[callurl] <## the CALL tag loops through the objects returned by the remote web site and automatically creates variables which contain the different components of the object. An object is either a Tag or the Text in between Tags. ##> <## if we have an anchor tag ##> <## attribute counter ##> <## put the tag back together with HREF only ##> <## looking for HREF attributes ##> <## got one! ##> &[callvalue] <&[callobjectelement] <## According to spec, when the value in an attribute/value pair contains a number it should *not* be in double quotes, but when it has non-numeric information, it *should* be in double quotes. Since the CALL tag strips away double quotes from the value in attribute/value pairs, we need to determine if a value is non-numeric so that we can put the double quotes back on when we reconstruct the tag. ##> = >

Analysis Of Links On: &[callurl]

Code In Between Link

Link For Code

<## relative link or mailto because no http in HREF ##> <## the following IF checks the object and makes sure that it has a / (slash) char at the beginning and adds it to the output object as long as it is not a mailto ##> <## now we add the relative link to the object or if it is a mailto then we assign the mailto value to the object ##> &[holdobject]